package easy;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class a1_两数之和 {

    public static void main(String[] args) {
//        Date date = new Date();
//        long time = date.getYear();
//        long month = date.getMonth();
//        long day = date.getDate();
//        System.out.println(time+1900);
//        System.out.println(month+1);
//        System.out.println(day);

//        Calendar cal = Calendar.getInstance();
//        cal.setTime(new Date());
//        cal.set(Calendar.DAY_OF_MONTH, 1);
//        cal.roll(Calendar.DAY_OF_MONTH, -1);
//        String start = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime());
//        System.out.println (start.substring(0,7));
//        System.out.println (start.substring(0,10));
//        String end = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime());
//        System.out.println (end.substring(8,10));
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date());
        cal.set(Calendar.DAY_OF_MONTH, 1);
        System.out.println (new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()).substring(8,10));
        cal.roll(Calendar.DAY_OF_MONTH, -1);
        System.out.println (new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()).substring(8,10));
    }
}
